/*
 */
package gclib;

import java.util.Collections;
import java.util.EnumMap;
import java.util.Map;

/**Races.java
 * 
 * Created Jul 22, 2009 11:35:46 PM
 * @author Jason
 */
public class Races {
    public static enum TYPE {Dragonborn, Dwarf, Eladrin, Elf, Half_Elf, Halfling, Human, Tiefling, Deva, Gnome, Golaith, Half_Orc, Longtooth_Shifter, Razorclaw_Shifter};
    private static Map<TYPE, Race> races = new EnumMap<TYPE, Race>(TYPE.class);

    private Races(){
//		races = new EnumMap<TYPE, Race>(TYPE.class);
		Map<Abilities.TYPE, Integer> abilityBonuses;

		//=Deva
		abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
		abilityBonuses.put(Abilities.TYPE.INT, 2);
		abilityBonuses.put(Abilities.TYPE.WIS, 2);

        races.put(TYPE.Deva, new Race("Deva", abilityBonuses));

		abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.STR, 2);
        abilityBonuses.put(Abilities.TYPE.CHA, 2);
        races.put(TYPE.Dragonborn, new Race("Dragonborn", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.CON, 2);
        abilityBonuses.put(Abilities.TYPE.WIS, 2);
        races.put(TYPE.Dwarf, new Race("Dwarf", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.DEX, 2);
        abilityBonuses.put(Abilities.TYPE.INT, 2);
        races.put(TYPE.Eladrin, new Race("Eladrin", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.DEX, 2);
        abilityBonuses.put(Abilities.TYPE.WIS, 2);
        races.put(TYPE.Elf, new Race("Elf", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.INT, 2);
        abilityBonuses.put(Abilities.TYPE.CHA, 2);
        races.put(TYPE.Gnome, new Race("Gnome", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.STR, 2);
        abilityBonuses.put(Abilities.TYPE.CON, 2);
        races.put(TYPE.Golaith, new Race("Goliath", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.CON, 2);
        abilityBonuses.put(Abilities.TYPE.CHA, 2);
        races.put(TYPE.Half_Elf, new Race("Half-Elf", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.STR, 2);
        abilityBonuses.put(Abilities.TYPE.DEX, 2);
        races.put(TYPE.Half_Orc, new Race("Half-Orc", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.DEX, 2);
        abilityBonuses.put(Abilities.TYPE.CHA, 2);
        races.put(TYPE.Halfling, new Race("Halfling", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        races.put(TYPE.Human, new Race("Human", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.STR, 2);
        abilityBonuses.put(Abilities.TYPE.WIS, 2);
        races.put(TYPE.Longtooth_Shifter, new Race("Longtooth Shifter", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.DEX, 2);
        abilityBonuses.put(Abilities.TYPE.WIS, 2);
        races.put(TYPE.Razorclaw_Shifter, new Race("Razorclaw Shifter", abilityBonuses));
        
        abilityBonuses = new EnumMap<Abilities.TYPE, Integer>(Abilities.TYPE.class);
        abilityBonuses.put(Abilities.TYPE.INT, 2);
        abilityBonuses.put(Abilities.TYPE.CHA, 2);
        races.put(TYPE.Tiefling, new Race("Tiefling", abilityBonuses));

		races = Collections.unmodifiableMap(races);
    }

    public static Race getRace(TYPE type){
        return races.get(type);
    }

	public static Races getInstance() {
		return RaceHolder.INSTANCE;
	}

	private static class RaceHolder {
		private static final Races INSTANCE = new Races();
	}
}
